import java.util.Scanner;
public class test522 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Loan Amount: ");
        double loanAmount = scanner.nextDouble();
        System.out.print("Number of Years: ");
        int years = scanner.nextInt();
        System.out.print("Annual Interest Rate: ");
        double annualRate = scanner.nextDouble();
        double monthlyRate = annualRate / 100 / 12;
        int months = years * 12;
        double monthlyPayment = loanAmount * monthlyRate * Math.pow(1 + monthlyRate, months)
                / (Math.pow(1 + monthlyRate, months) - 1);
        double totalPayment = monthlyPayment * months;
        System.out.printf("Monthly Payment: %.2f%n", monthlyPayment);
        System.out.printf("Total Payment: %.2f%n", totalPayment);
        System.out.printf("%-10s%-10s%-10s%-10s%n", "Payment#", "Interest", "Principal", "Balance");
        double balance = loanAmount;
        for (int i = 1; i <= months; i++) {
            double interest = balance * monthlyRate;
            double principal = monthlyPayment - interest;
            balance -= principal;
            if (i == months) {
                principal += balance;
                balance = 0;
            }
            System.out.printf("%-10d%-10.2f%-10.2f%-10.2f%n", i, interest, principal, balance);
        }
        scanner.close();
    }
}
